package behavior.command;

import behavior.command.command.IMoveCommand;
import behavior.command.command.MoveCommand;
import behavior.command.receiver.BackReceiver;
import behavior.command.receiver.ForwardReceiver;

public class Demo {
    public static void main(String[] args) {
        MoveObject moveObject = new MoveObject(0, 0);
        MoveControl moveControl = new MoveControl();
        IMoveCommand forwardCommand =  new MoveCommand(new ForwardReceiver(moveObject));
        IMoveCommand backCommand =  new MoveCommand(new BackReceiver(moveObject));

        moveControl.move(forwardCommand);
        moveControl.move(forwardCommand);
        moveControl.back();
        moveControl.back();
        moveControl.move(backCommand);
        moveControl.undo();

        System.out.println(moveObject.toString());
    }
}
